/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jjsoft.celularessuc.gco.mdl;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Johnny
 */
@Entity
@Table(catalog = "celularessuccom", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sucursal.findAll", query = "SELECT s FROM Sucursal s"),
    @NamedQuery(name = "Sucursal.findByIdsucursal", query = "SELECT s FROM Sucursal s WHERE s.idsucursal = :idsucursal"),
    @NamedQuery(name = "Sucursal.findByNombre", query = "SELECT s FROM Sucursal s WHERE s.nombre = :nombre"),
    @NamedQuery(name = "Sucursal.findByEstado", query = "SELECT s FROM Sucursal s WHERE s.estado = :estado")})
public class Sucursal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer idsucursal;
    @Column(length = 45)
    private String nombre;
    private Integer estado;
    @OneToMany(mappedBy = "idSucursal")
    private List<Configuracion> configuracionList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idSucursal")
    private List<Factura> facturaList;
    @OneToMany(mappedBy = "idSucursal")
    private List<Deuda> deudaList;
    @OneToMany(mappedBy = "idSucursal")
    private List<Serie> serieList;
    @OneToMany(mappedBy = "idSucursal")
    private List<Proforma> proformaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idSucursal")
    private List<Serviciotecnico> serviciotecnicoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idSucursal")
    private List<FacturaCompra> facturaCompraList;
    @OneToMany(mappedBy = "idSucursal")
    private List<Articulosucursal> articulosucursalList;

    public Sucursal() {
    }

    public Sucursal(Integer idsucursal) {
        this.idsucursal = idsucursal;
    }

    public Integer getIdsucursal() {
        return idsucursal;
    }

    public void setIdsucursal(Integer idsucursal) {
        this.idsucursal = idsucursal;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    @XmlTransient
    @JsonIgnore
    public List<Configuracion> getConfiguracionList() {
        return configuracionList;
    }

    public void setConfiguracionList(List<Configuracion> configuracionList) {
        this.configuracionList = configuracionList;
    }

    @XmlTransient
    @JsonIgnore
    public List<Factura> getFacturaList() {
        return facturaList;
    }

    public void setFacturaList(List<Factura> facturaList) {
        this.facturaList = facturaList;
    }

    @XmlTransient
    @JsonIgnore
    public List<Deuda> getDeudaList() {
        return deudaList;
    }

    public void setDeudaList(List<Deuda> deudaList) {
        this.deudaList = deudaList;
    }

    @XmlTransient
    @JsonIgnore
    public List<Serie> getSerieList() {
        return serieList;
    }

    public void setSerieList(List<Serie> serieList) {
        this.serieList = serieList;
    }

    @XmlTransient
    @JsonIgnore
    public List<Proforma> getProformaList() {
        return proformaList;
    }

    public void setProformaList(List<Proforma> proformaList) {
        this.proformaList = proformaList;
    }

    @XmlTransient
    @JsonIgnore
    public List<Serviciotecnico> getServiciotecnicoList() {
        return serviciotecnicoList;
    }

    public void setServiciotecnicoList(List<Serviciotecnico> serviciotecnicoList) {
        this.serviciotecnicoList = serviciotecnicoList;
    }

    @XmlTransient
    @JsonIgnore
    public List<FacturaCompra> getFacturaCompraList() {
        return facturaCompraList;
    }

    public void setFacturaCompraList(List<FacturaCompra> facturaCompraList) {
        this.facturaCompraList = facturaCompraList;
    }

    @XmlTransient
    @JsonIgnore
    public List<Articulosucursal> getArticulosucursalList() {
        return articulosucursalList;
    }

    public void setArticulosucursalList(List<Articulosucursal> articulosucursalList) {
        this.articulosucursalList = articulosucursalList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idsucursal != null ? idsucursal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sucursal)) {
            return false;
        }
        Sucursal other = (Sucursal) object;
        if ((this.idsucursal == null && other.idsucursal != null) || (this.idsucursal != null && !this.idsucursal.equals(other.idsucursal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jjsoft.celularessuc.gco.mdl.Sucursal[ idsucursal=" + idsucursal + " ]";
    }
    
}
